import {Entity,Column,PrimaryGeneratedColumn,CreateDateColumn, OneToMany, OneToOne, JoinColumn} from "typeorm"
import {Works} from "../../works/entities/works.entity"
import {Identity} from "./identity.entity"

@Entity()
export class My{
    @PrimaryGeneratedColumn({type:"int",name:"id"})
    id:number

    @Column({type:"varchar",length:100})
    username:string


    @Column({type:"varchar",length:150})
    phone:string

    @Column({type:"varchar",length:150,select:false})
    password:string


    @CreateDateColumn({type:"timestamp"})
    createTime:Date

    @Column({type:"varchar",length:150,default:"1676966892858.gif"})
    avator:string

    @Column({type:"varchar",length:100,default:0})
    class:string

    @Column({type:"varchar",length:100,default:0})
    team:string
    


    @OneToMany(()=>Works,works=>works.my)
    // @JoinColumn()
    works:Works[]

}

@Entity()

export class Staff{
    @PrimaryGeneratedColumn({type:"int",name:"staffId"})
    staffId:number

    @Column({type:"varchar",length:100})
    staffName:string
    
    @Column({type:"varchar",length:100})
    idCard:string

    @Column({type:"varchar",length:50,default:18})
    age:string

    @Column({type:"varchar",length:10,default:1})
    gender:string

    @Column({type:"varchar",length:100})
    address:string

    @CreateDateColumn({type:"timestamp"})
    registerTime:Date

    @Column({type:"varchar",length:100})
    mailbox:string

    @Column({type:"varchar",length:50,default:0})
    relation:string
    @Column({type:"varchar",length:100})
    imageUrl:string
    @Column({type:"varchar",length:50})
    phone:string
    
    @OneToOne(()=>Identity,(identity=>identity.staff))
    identity:Identity

}

